from decimal import Decimal
from typing import TypedDict, Literal

type angle_model = str  # 角钢型号，例如 ‘40*3*6‘
type angle_code = str  # 角钢物料编码，例如 ‘4036A‘


class angle_steel_piece(TypedDict):
    whole_piece: int
    scatt_piece: int
    id: int


class material_belong_same_angle_model(TypedDict):
    set_piece: int
    material: dict[angle_code, angle_steel_piece]


# 返回一种特别的角钢全部库存的格式，用于销售表
type special_all_angle_steel_list = dict[angle_model, material_belong_same_angle_model]


# 返回件数和差值
class whole_piece_weight_d_value(TypedDict):
    piece: int
    weight: Decimal


class piece_weight(TypedDict):
    whole_piece: int
    weight: Decimal
    theory_weight: Decimal


# 返回一种特别的角钢全部库存的格式，用于企管表
type angle_weight_table = dict[angle_model, piece_weight]

# 带钢销售表每行格式
class strip_steel_sale_table(TypedDict):
    id: int
    code: str
    model: str
    name: str
    whole_piece: int
    weight: Decimal

# 角钢自动库存表手填部分所需数据
class angle_steel_manual_table(TypedDict):
    material__code: str
    whole_piece: int
    weight: Decimal


type inventory_material_type1 = Literal['235_1', '235_2', '235_3', '235_4', '345_1', '345_2']


class inventory_material_type2(TypedDict):
    model: str
    set_piece: int
    total: int
    A: int
    B: int
    C: int
    D: int
    G: int
    A_id: int
    B_id: int
    C_id: int
    D_id: int
    G_id: int

# 一种特殊规格，用于角钢盘库调整表格
type inventory_material_type3 = dict[inventory_material_type1, list[inventory_material_type2]]


class rust_angle_steel_data(TypedDict):
    code: str
    model: str
    whole_piece: int
    id: int


type rust_angle_steel_dict = dict[angle_model, rust_angle_steel_data]


class rust_angle_steel_row_data(TypedDict):
    model_1: str
    piece_1: int
    id_1: int
    code_1: str
    model_2: str
    piece_2: int
    id_2: int
    code_2: str
    model_3: str
    piece_3: int
    id_3: int
    code_3: str
    model_4: str
    piece_4: int
    id_4: int
    code_4: str


# 锈角钢特殊格式
type rust_angle_steel_list = list[rust_angle_steel_row_data]


# 锈角钢特殊格式
rust_angle_steel_use = [
    ['40*3*6', '63*5*6', '75*7*6', '90*8*6'],
    ['40*3*7', '63*5*7', '75*7*7', '90*8*7'],
    ['40*3*8', '63*5*8', '75*7*8', '90*8*8'],
    ['40*3*9', '63*5*9', '75*7*9', '90*8*9'],
    ['40*3*10', '63*5*10', '75*7*10', '90*8*10'],
    ['', '63*5*11', '75*7*11', '90*8*11'],
    ['40*4*6', '63*5*12', '75*7*12', '90*8*12'],
    ['40*4*7', '', '', ''],
    ['40*4*8', '63*6*6', '75*8*6', ''],
    ['40*4*9', '63*6*7', '75*8*7', ''],
    ['40*4*10', '63*6*8', '75*8*8', ''],
    ['', '63*6*9', '75*8*9', ''],
    ['45*4*6', '63*6*10', '75*8*10', ''],
    ['45*4*7', '63*6*11', '75*8*11', ''],
    ['45*4*8', '63*6*12', '75*8*12', ''],
    ['45*4*9', '', '', ''],
    ['45*4*10', '70*5*6', '80*6*6', ''],
    ['', '70*5*7', '80*6*7', ''],
    ['45*5*6', '70*5*8', '80*6*8', ''],
    ['45*5*7', '70*5*9', '80*6*9', ''],
    ['45*5*8', '70*5*10', '80*6*10', ''],
    ['45*5*9', '70*5*11', '80*6*11', ''],
    ['45*5*10', '70*5*12', '80*6*12', ''],
    ['', '', '', ''],
    ['50*4*6', '70*6*6', '80*7*6', ''],
    ['50*4*7', '70*6*7', '80*7*7', ''],
    ['50*4*8', '70*6*8', '80*7*8', ''],
    ['50*4*9', '70*6*9', '80*7*9', ''],
    ['50*4*10', '70*6*10', '80*7*10', ''],
    ['50*4*11', '70*6*11', '80*7*11', ''],
    ['50*4*12', '70*6*12', '80*7*12', ''],
    ['', '', '', ''],
    ['50*5*6', '70*7*6', '80*8*6', ''],
    ['50*5*7', '70*7*7', '80*8*7', ''],
    ['50*5*8', '70*7*8', '80*8*8', ''],
    ['50*5*9', '70*7*9', '80*8*9', ''],
    ['50*5*10', '70*7*10', '80*8*10', ''],
    ['50*5*11', '70*7*11', '80*8*11', ''],
    ['50*5*12', '70*7*12', '80*8*12', ''],
    ['', '', '', ''],
    ['56*4*6', '75*5*6', '90*6*6', ''],
    ['56*4*7', '75*5*7', '90*6*7', ''],
    ['56*4*8', '75*5*8', '90*6*8', ''],
    ['56*4*9', '75*5*9', '90*6*9', ''],
    ['56*4*10', '75*5*10', '90*6*10', ''],
    ['56*4*11', '75*5*11', '90*6*11', ''],
    ['56*4*12', '75*5*12', '90*6*12', ''],
    ['', '', '', ''],
    ['56*5*6', '75*6*6', '90*7*6', ''],
    ['56*5*7', '75*6*7', '90*7*7', ''],
    ['56*5*8', '75*6*8', '90*7*8', ''],
    ['56*5*9', '75*6*9', '90*7*9', ''],
    ['56*5*10', '75*6*10', '90*7*10', ''],
    ['56*5*11', '75*6*11', '90*7*11', ''],
    ['56*5*12', '75*6*12', '90*7*12', ''],
]